package com.ruoyi.common.verify.validator;

import cn.hutool.core.util.PhoneUtil;
import com.ruoyi.common.verify.BaseValidator;
import com.ruoyi.common.verify.annotation.Phone;

/**
 * 自定义手机号校验注解实现
 *
 * @author ruoyi
 */
public class PhoneValidator extends BaseValidator<Phone, String> {
    public boolean valid(String value, Phone idCard) {
        if (idCard.isNotNull() && !isNotNull(value)) {
            return false;
        }
        return PhoneUtil.isPhone(value);
    }
}
